<template>
    <div>
      <button @click="qrcode">支付</button>
      <!--<div id="qrcode"  ></div>-->
        <!--<span>付款金额:</span>-->
      <!--</div>-->

      <div class="checkout py-container  pay" >
        <div class="checkout-tit">
          <span class="fr"><em class="sui-lead">应付金额：</em><em class="orange money">￥{{payObj.total_fee}}</em></span>
        </div>
      </div>

      <div class="checkout-steps">
        <div class="fl sao">
          <div class="fl code">
            <span>测试:{{payObj}}</span>
            <qriously v-if="payObj!=''" :value="payObj.code_url" :size="338"/>
            <div>订单的状态:{{paystatus}}</div>
          </div>
        </div>

        </div>

    </div>
</template>

<script>
  //import QRCode from 'qrcodejs2'
  import axios from 'axios'
    export default {
        name: "pay",
        data(){
          return {
            payObj:'',
            hidestatus:false,
            timer1:'',
            paystatus:''
          }
        },
         methods:{
          qrcode() {
            axios.get("http://localhost:8080/erweima?orderno=tttttt999").then(r=>{
              this.payObj=r.data.t;
            })


        },

           queryPayStatus(ordernum){
              axios.get("http://localhost:8080/getPayStatus/"+ordernum).then(r=>{
                //alert(JSON.stringify(r.data.msg));
                this.paystatus=r.data.t.trade_state_desc;
              })
          }
      },
      mounted(){
          //设置一个定时任务，每隔3秒调用一次
        this.timer1 = setInterval(() => {
          this.queryPayStatus(this.payObj.out_trade_no)
        }, 3000);
      }
    }
</script>

<style scoped>

</style>
